# 配置文件数据操作
#coding=utf-8
import os
import toml
def read_config(key=None):

    try:
        config
        if os.path.exists("config.toml"):
            config = toml.load("config.toml") 
        else:
            config = toml.load("default-config.toml")   

        if key is not None and config.get(key):
            return config[key]
        else:
            return config
    except IOError as e:
        print("配置读取失败，请检查是否有配置文件或者配置是否正确", e)
        return None


    
 